package com.zhuss.vent.vent;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.zhuss.bean.bo.vent.vent.wechat.DelTopicVentBo;
import com.zhuss.bean.bo.vent.vent.wechat.TopicVentBo;
import com.zhuss.bean.bo.vent.vent.CreateVentBo;
import com.zhuss.bean.bo.vent.vent.DeleteVentBo;
import com.zhuss.bean.bo.vent.vent.UpdateVentBo;
import com.zhuss.bean.bo.vent.vent.wechat.CollectVentBo;
import com.zhuss.bean.bo.vent.vent.wechat.ForwardVentBo;
import com.zhuss.bean.bo.vent.vent.wechat.ThumbVentBo;
import com.zhuss.common.OperateService;
import com.zhuss.common.Processor;
import com.zhuss.exception.WpsException;

/**
 * vent操作service（基本操作）
 * @author zhushanshuo
 * @Date 2020-02-05 15:59
 *
 */
@Component("ventOperateService")
public class VentOperateService implements OperateService<Void, Object> {
	
	@Autowired
	@Qualifier("ventCreate")
	private Processor<Object, CreateVentBo> ventCreate;
	
	@Autowired
	@Qualifier("ventUpdate")
	private Processor<Object, UpdateVentBo> ventUpdate;
	
	@Autowired
	@Qualifier("ventDelete")
	private Processor<Object, DeleteVentBo> ventDelete;
	
	@Autowired
	@Qualifier("ventThumb")
	private Processor<Object, ThumbVentBo> ventThumb;
	
	@Autowired
	@Qualifier("ventCollect")
	private Processor<Object, CollectVentBo> ventCollect;
	
	@Autowired
	@Qualifier("ventForward")
	private Processor<Object, ForwardVentBo> ventForward;
	
	@Autowired
	@Qualifier("ventTopic")
	private Processor<Object, TopicVentBo> ventTopic;
	
	@Autowired
	@Qualifier("ventDelThumb")
	private Processor<Object, ThumbVentBo> ventDelThumb;
	
	@Autowired
	@Qualifier("ventDelCollect")
	private Processor<Object, CollectVentBo> ventDelCollect;
	
	@Autowired
	@Qualifier("ventDelForward")
	private Processor<Object, ForwardVentBo> ventDelForward;
	
	@Autowired
	@Qualifier("ventDelTopic")
	private Processor<Object, DelTopicVentBo> ventDelTopic;
	
	/**
	 * 创建
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
	public Void create(Object param) throws WpsException {
		
		CreateVentBo bo = (CreateVentBo) param;
		
		ventCreate.process(bo);
		
		return null;
	}
    
	/**
	 * 修改
	 */
	@Override
    @Transactional(rollbackFor = Exception.class)
    public Void update(Object param) throws WpsException {
    	
		UpdateVentBo bo = (UpdateVentBo) param;
		
		ventUpdate.process(bo);
		
    	return null;
    }
	
	/**
	 * 删除
	 */
	@Override
	@Transactional(rollbackFor = Exception.class)
	public Void delete(Object param) throws WpsException {
		
		DeleteVentBo bo = (DeleteVentBo) param;
		
		ventDelete.process(bo);
		
		return null;
	}
	
	/**
	 * 点赞
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void thumb(Object param) throws WpsException {
		
		ThumbVentBo bo = (ThumbVentBo) param;
		
		ventThumb.process(bo);
		
		return null;
	}
	
	/**
	 * 收藏
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void collect(Object param) throws WpsException {
		
		CollectVentBo bo = (CollectVentBo) param;
		
		ventCollect.process(bo);
		
		return null;
	}
	
	/**
	 * 转发
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void forward(Object param) throws WpsException {
		
		ForwardVentBo bo = (ForwardVentBo) param;
		
		ventForward.process(bo);
		
		return null;
	}
	
	/**
	 * 评论
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void topic(Object param) throws WpsException {
		
		TopicVentBo bo = (TopicVentBo) param;
		
		ventTopic.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 点赞
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delThumb(Object param) throws WpsException {
		
		ThumbVentBo bo = (ThumbVentBo) param;
		
		ventDelThumb.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 收藏
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delCollect(Object param) throws WpsException {
		
		CollectVentBo bo = (CollectVentBo) param;
		
		ventDelCollect.process(bo);
		
		return null;
	}
	
	/**
	 * 取消
	 * 转发
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delForward(Object param) throws WpsException {
		
		ForwardVentBo bo = (ForwardVentBo) param;
		
		ventDelForward.process(bo);
		
		return null;
	}
	
	/**
	 * 删
	 * 评论
	 */
	@Transactional(rollbackFor = Exception.class)
	public Void delTopic(Object param) throws WpsException {
		
		DelTopicVentBo bo = (DelTopicVentBo) param;
		
		ventDelTopic.process(bo);
		
		return null;
	}
	
}

